package com.seleniti.enpareja.controller.control.factory;

import org.ioc.commons.flowcontrol.eventbus.IsEventBus;
import org.ioc.commons.flowcontrol.logincontroller.LoginController;
import org.ioc.commons.flowcontrol.messageboxfactory.MessageBoxFactory;
import org.ioc.commons.flowcontrol.notificator.Notificator;
import org.ioc.commons.flowcontrol.placecontroller.PlaceController;
import org.ioc.commons.flowcontrol.taskcontroller.TaskController;
import org.ioc.commons.i18n.DateTimeFormatter;
import org.ioc.commons.i18n.NumberFormatter;
import org.ioc.commons.integration.dataaccess.localstorage.LocalClientStorage;
import org.ioc.commons.model.clientfactory.ClientFactoryProvider;
import org.ioc.commons.model.globaldata.GlobalDataController;

import com.seleniti.enpareja.controller.common.GlobalData;
import com.seleniti.enpareja.controller.common.LocalData;
import com.seleniti.enpareja.controller.common.domain.LoggedUserInfo;
import com.seleniti.enpareja.controller.control.controller.LoginFailedCause;
import com.seleniti.enpareja.controller.control.controller.LoginParams;
import com.seleniti.enpareja.controller.model.integration.service.EnParejaServiceManager;
import com.seleniti.enpareja.controller.ui.main.AppShell;

/**
 * Factory of client-objects
 * 
 * @author Jesús Lunar Pérez
 */
public interface ClientFactory {
	/**
	 * The main app controller.
	 * 
	 * @return
	 */
	ClientFactoryProvider<? extends EnParejaAppController> getAppController();

	/**
	 * Controller in charge of navigation through the views on the application.
	 * 
	 * @return
	 */
	ClientFactoryProvider<? extends PlaceController> getPlaceController();

	/**
	 * The controller for managing uncaught exception
	 * 
	 * @return
	 */
	EnParejaExceptionController getExceptionController();

	/**
	 * Controller for asynchronous and scheduled tasks.
	 * 
	 * @return
	 */
	ClientFactoryProvider<? extends TaskController> getTaskController();

	/**
	 * Pop-up message box factory.
	 */
	ClientFactoryProvider<MessageBoxFactory> getMessageBoxFactory();

	/**
	 * Service manager of the application.
	 * 
	 * It provides a manager for getting Services through a factory.
	 */
	EnParejaServiceManager getServiceManager();

	/**
	 * Common shell for all the views on the application
	 * 
	 * @return
	 */
	AppShell getShell();

	/**
	 * The global event bus used by the application
	 * 
	 * @return
	 */
	IsEventBus getGlobalEventBus();

	/**
	 * The controller for sharing and control global data in entire application
	 * 
	 * @return
	 */
	GlobalDataController<GlobalData> getGlobalDataController();

	/**
	 * The login controller
	 * 
	 * @return
	 */
	LoginController<LoggedUserInfo, LoginFailedCause, LoginParams, String> getLoginController();

	/**
	 * The date time formatter
	 * 
	 * @return
	 */
	DateTimeFormatter getDateTimeFormatter();

	/**
	 * The number formatter
	 * 
	 * @return
	 */
	NumberFormatter getNumberFormatter();

	/**
	 * Local client storage such as, cookies, local files, etc.
	 */
	LocalClientStorage<LocalData> getLocalClientStorage();

	public enum NotificationIcons {
		APP_ICON, OK_ICON, CANCEL_ICON, CALENDAR_ICON;
	}

	public ClientFactoryProvider<? extends Notificator<NotificationIcons>> getNotificator();
}
